<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<include file="Public:base" />

<script type="text/javascript">
$(document).ready(function() {
	
	
	$("[id^=lock]").on("click", function () {
		   var idval = $(this).attr("id");
		   var id = idval.split("_")[1];
	     	$.post("__URL__/lock/id/"+id, function (result) {
	     		if(result=="lock"){
	     			bootbox.alert("已锁定", function() {
	                  $("#lock_"+id).parent().html('状态： 锁定<a id="lock_'+id+'">点击开启</a>');
	              });
	     		}else if(result=="unlock"){
	     			bootbox.alert("已开启", function() {
		                  $("#lock_"+id).parent().html('状态： 开启<a id="lock_'+id+'">点击锁定</a>');
		              });
	     		}else {
	     			bootbox.alert("处理失败", function() {
	                  //console.log("Alert Callback");
	              });
	     		}
	     		
		    }); 
	});
	
	
	$("[id^=delart]").on("click", function () {
		 var idval = $(this).attr("id");
		 bootbox.confirm("确认删除", function(result) {
          if(result){
       	   var id = idval.split("_")[1];
       	 	$.post("__URL__/del/id/"+id, function (result) {
	       		if(result=="del"){
                    $("#comm-item_"+id).hide();
	       		}else {
	       			bootbox.alert("删除失败", function() {
                        //console.log("Alert Callback");
                 });
	       		}
	       		
		    }); 	
   	       	
          }
        });
   });
	
});
</script>
</head>
<body>
<include file="Public:header" />
<div class="home-index">

<div class="opts-wrap">
  
</div> 

  <div class="col-xs-12">
    <div class="row">
    	<h3>活动检索</h3>
    	<div class="search-form">
    		
		    <form class="form-inline" role="form" action="__URL__/index" method="get" >
		      <div class="form-group ">
		        <label class="sr-only" >关键词</label>
		        <input type="text" class="form-control" placeholder="按标题" name="title" value="{$title}">
		      </div>
		      <button id="search" type="submit" class="btn btn-primary">检索</button>
		    </form>
		  </div>
		<hr>  

    	<div class="title">
    		<h3>活动列表</h3>
    		<a href="__URL__/add" class="btn btn-primary">添加</a>
    	</div>


        
		<volist name='data' id='vo'>
	   		
	   		<div id="comm-item_{$vo.id}" class="comm-item">
	   			
	          <p class="art-title"><label>标题：</label><a href="__APP__/Home/Act/info/id/{$vo.id}" target="_blank">{$vo.title}</a></p>

	          <p><label>作者：</label>{$vo.author}</p>
	          <p>状态：
	            	<if condition=" $vo.status ">
			 		锁定 | <a id="lock_{$vo.id}" >开启</a>
			 		<else />
					 开启 | <a id="lock_{$vo.id}" >锁定</a>
					 </if>
	            </p>
	            
	          <p><label>开始日期：</label>{$vo.start_at|date="Y-m-d",###}</p>
	          <p><label>结束日期：</label>{$vo.end_at|date="Y-m-d",###}</p>
	          <p><label>参与人数：</label> {$vo.join_num} </p>  
	          <p><label>点击量：</label> {$vo.hits} </p>
	          <p><label>创建时间：</label>{$vo.created_at|date="Y-m-d H:i:s",###}</p>
	   
	          <div class="btn-group">
	            <a href="__URL__/modify/id/{$vo.id}" title="编辑" class="glyphicon glyphicon-pencil"></a>
	            <a id="delart_{$vo.id}" href="javascript:;" title="删除"  class="glyphicon glyphicon-trash"></a>

	            <a href="__MODULE__/ActData/index/id/{$vo.id}" title="报名情况" class="glyphicon glyphicon-folder-open"></a>
	          </div>
	        </div>
	   		
	   </volist>     
	        
	</div>
  </div>
  {$page}
</div>
</div>
</body>
</html>